package com.easemob.helpdesk.activity;

import android.app.Activity;
import android.content.Context;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;

import static android.os.Build.VERSION.SDK;
import static android.os.Build.VERSION.SDK_INT;

import androidx.appcompat.app.AppCompatActivity;

public class BaseActivityV2 extends AppCompatActivity {
	private InputMethodManager manager;

	protected Activity mActivity;

	/**
	 * Perform initialization of all fragments and loaders.
	 *
	 * @param savedInstanceState
	 */
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		mActivity = this;
		initFindView();
		manager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);

//		Window window = getWindow();
//		window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS
//				| WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
//		window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
//				| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
//				| View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
//		window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
		// 虚拟导航键
//		if (Build.VERSION.SDK_INT >= 21) {
//			window.setNavigationBarColor(Color.TRANSPARENT);
//		}
	}

	/**
	 * 隐藏软键盘
	 */
	protected void hideKeyboard() {
		if (getWindow().getAttributes().softInputMode != WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN) {
			if (getCurrentFocus() != null)
				manager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
		}
	}

	protected  void initFindView(){}


}
